import {
  VuexModule,
  Module,
  Mutation,
  getModule
} from 'vuex-module-decorators';

import store from '@/store';

export interface ICounterState {
  double: number;
}

@Module({
  dynamic: true,
  store,
  name: 'counter'
})
class Counter extends VuexModule implements ICounterState {
  double = 0;

  @Mutation
  SET_DOUBLE(double: ICounterState['double']) {
    this.double += double;
  }
}

export const CounterModule = getModule(Counter);
